using System;
using System.Data;
using System.Collections;

/*
    CssDom Library
    Copyright (C) 2007-2011  Ferenc Veres

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

namespace WPS.Libraries.CssDom
{
	/// <summary>
	/// The CSSRule class is the abstract base interface for any type of CSS statement. 
	/// This includes both rule sets and at-rules. 
	/// </summary>
	public abstract class CSSRule
	{
		#region Rule type constants

		/// <summary>The rule is a CSSUnknownRule.</summary>
		public static int UNKNOWN_RULE = 0;
		
		/// <summary>The rule is a CSSStyleRule.</summary>
		public static int STYLE_RULE = 1;
		
		/// <summary>The rule is a CSSCharsetRule.</summary>
		public static int CHARSET_RULE = 2;

		/// <summary>The rule is a CSSImportRule.</summary>
		public static int IMPORT_RULE = 3;

		/// <summary>The rule is a CSSMediaRule.</summary>
		public static int MEDIA_RULE = 4;
		
		/// <summary>The rule is a CSSFontFaceRule.</summary>
		public static int FONT_FACE_RULE = 5;

		/// <summary>The rule is a CSSPageRule.</summary>
		public static int PAGE_RULE = 6;

		#endregion

		#region CSSRule Interface properties

		/// <summary>
		/// The type of the rule, as defined by constants in this class.
		/// </summary>
		/// <remarks>
		/// The expectation is that binding-specific casting methods can be used 
		/// to cast down from an instance of the CSSRule interface to the specific 
		/// derived interface implied by the type.
		/// </remarks>
		public int type
		{
			get
			{
				return m_type;
			}
		}
		protected int m_type;

		/// <summary>
		/// The parsable textual representation of the rule. 
		/// </summary>
		/// <remarks>
		/// This reflects the current state of the rule and not its initial value.
		/// </remarks>
		public string cssText
		{
			get
			{
				return getCssText();
			}
			set
			{
				setCssText(value);
			}
		}

		/// <summary>
		/// The style sheet that contains this rule.
		/// </summary>
		public CSSStyleSheet parentStyleSheet
		{
			get
			{
				return null;
			}
		}

		/// <summary>
		/// If this rule is contained inside another rule 
		/// (e.g. a style rule inside an @media block), this is the containing rule. 
		/// If this rule is not nested inside any other rules, this returns null.
		/// </summary>
		public CSSRule parentRule
		{
			get
			{
				return null;
			}
		}

		#endregion

		#region Implementation related, nonstandard functions

		/// <summary>
		/// Defined by derivations to return the cssText property.
		/// </summary>
		/// <returns>Contents of the cssText property.</returns>
		public virtual string getCssText()
		{
			// Defined by derivations.
			return "";
		}

		/// <summary>
		/// Defined by derivations, to set the cssText property.
		/// </summary>
		/// <param name="rule">The new value for cssText property.</param>
		public virtual void setCssText(string rule)
		{
			// Defined by derivations
		}

		#endregion

	}
}
